# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : zsj.py
# @Time     : 2024/4/16 19:33
# @Author   : Robot-Zsj
"""
description:

i:
2 2 3
o:
7
"""

import math
import pdb

nums = list(map(int, input().split()))


def getResult():
    cnts = {}

    for num in nums:
        cnts[num] = cnts.get(num, 0) + 1

    ans = 0
    for key in cnts.keys():
        total = key + 1
        ans += math.ceil(cnts[key] / total) * total

    return ans


print(getResult())
